package com.solace.selenium.controller;

import com.alibaba.fastjson.JSONArray;
import com.solace.selenium.entity.JsonResult;
import com.solace.selenium.entity.SysTask;
import com.solace.selenium.service.WebDriverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@RestController
@RequestMapping("web")
public class WebController {
    @Autowired
    WebDriverService webDriverService;
    //跳转
    @RequestMapping(value = "getUrl")
    public JsonResult getUrl(String url) {
        webDriverService.getUrl(url);
        return new JsonResult("OK");
    }
    //下架
    @RequestMapping(value = "delete")
    public JsonResult delete(String id) {
        webDriverService.soldOut(id);
        return new JsonResult("OK");
    }
    //上架
    @RequestMapping(value = "shelves")
    public JsonResult shelves(String goodsId) {
        webDriverService.shelves(goodsId);
        return new JsonResult("OK");
    }
    //设置序号
    @RequestMapping(value = "updateGoodsNumber")
    public JsonResult updateGoodsNumber(String goodsId,String number) {
        webDriverService.goodsNumber(goodsId,number);
        return new JsonResult("OK");
    }
    //讲解
    @RequestMapping(value = "commentator")
    public JsonResult commentator(String goodsId) {
        webDriverService.commentator(goodsId);
        return new JsonResult("OK");
    }
    //写入local
    @RequestMapping(value = "addLocalStorage")
    public JsonResult addLocalStorage() {
        webDriverService.addLocalStorage();
        return new JsonResult("OK");
    }
    //复制分组

}
